import express from "express";
import userService from "./services/userService";
import os from "os";
import numeral from "numeral"; // MB 单位格式转换
import bailianService from "./services/visualPlatformServer";

const router = express.Router();

// 添加一个用户
router.get('/add_user', userService.add_user);
// 获取用户信息
router.get('/get_user_info', userService.get_user);
//ping
router.get('/ping', async (req: express.Request, res: express.Response, next: express.NextFunction) => {
    res.send(JSON.stringify({
        cup: os.cpus().length, // 获取CPU信息  
        totalmem: numeral(os.totalmem()).format('0.0b'), // 总内存
        freemem: numeral(os.freemem()).format('0.0b'),// 空闲内存
    }))
});


// 人像动漫
router.post('/anime', bailianService.anime);


export default router;